<?php


	/**
     *  数组生成Excel文件
     * 
     *  
     */
	  function arrayToExcel($list, $filename,$fun=''){
		require_once ("../PHPExcel.php");
        $objPHPExcel = new \PHPExcel();
        $styleArray = array(
            'borders' => array(
                'allborders' => array(                 
                    'style' => \PHPExcel_Style_Border::BORDER_THIN,//细边框                  
                ),
            ),
        );
        $objPHPExcel = $fun($objPHPExcel,$list);
        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        $objWriter->save($filename . '.xls');
       
    		  
	  }
	   


	  /**
	   * 生成正常订单数据
	   * @param unknown $objPHPExcel
	   * @param unknown $list
	   * @return unknown
	   */
	  function SEND_00($objPHPExcel,$list){
	      $objPHPExcel->setActiveSheetIndex(0)
	      ->setCellValue('A1', '快递公司')
	      ->setCellValue('B1', '快递单号')
	      ->setCellValue('C1', '状态')
	      ->setCellValue('D1', '签收时间')
	      ->setCellValue('E1', '签收信息')
	      ->setCellValue('F1', '揽件时间')
	      ->setCellValue('G1', '揽件信息');
	      
	      
	      $num = 2;
	      $objPHPExcel->getActiveSheet()->getStyle('A')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
	      foreach ($list as $k => $v) {
	          //print_r($v);exit;
	          //ECHO $v[13];EXIT;
	          $objPHPExcel->getActiveSheet()->setCellValueExplicit('A' . $num, $v[0], \PHPExcel_Cell_DataType::TYPE_STRING);
	          $objPHPExcel->getActiveSheet()->setCellValueExplicit('B' . $num, $v[1], \PHPExcel_Cell_DataType::TYPE_STRING);
	          $objPHPExcel->getActiveSheet()->setCellValueExplicit('C' . $num, $v[3], \PHPExcel_Cell_DataType::TYPE_STRING);
	          $objPHPExcel->getActiveSheet()->setCellValueExplicit('D' . $num, $v[4], \PHPExcel_Cell_DataType::TYPE_STRING);
	          $objPHPExcel->getActiveSheet()->setCellValueExplicit('E' . $num, iconv('gb2312', 'utf-8', $v[18]), \PHPExcel_Cell_DataType::TYPE_STRING);
	          $objPHPExcel->getActiveSheet()->setCellValueExplicit('F' . $num, $v[17], \PHPExcel_Cell_DataType::TYPE_STRING);
	          $objPHPExcel->getActiveSheet()->setCellValueExplicit('G' . $num, iconv('gb2312', 'utf-8', $v[18]), \PHPExcel_Cell_DataType::TYPE_STRING);
	         
		
			 
			 $objPHPExcel->setActiveSheetIndex(0)
	          ->setCellValue('A' . $num, $v[0]." ")
	          ->setCellValue('B' . $num, $v[1]." ")
	          ->setCellValue('C' . $num, $v[3])
	          ->setCellValue('D' . $num, $v[4])
	          ->setCellValue('E' . $num, $v[16])
	          ->setCellValue('F' . $num, $v[17])
	          ->setCellValue('G' . $num, $v[19]);
	          	
	          $objPHPExcel->getActiveSheet()
	          ->getStyle('B' . $num)
	          ->getNumberFormat()
	          ->setFormatCode("@");
	          $num ++;
	      }
	      $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(25);
	      $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
	      $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
	      $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
	      $objPHPExcel->getActiveSheet()->setTitle('订单列表');
	      $objPHPExcel->setActiveSheetIndex(0);
	      return $objPHPExcel;
	  }